<?php

/**
 * LoginForm class.
 * LoginForm is the data structure for keeping
 * user login form data. It is used by the 'login' action of 'SiteController'.
 */
class ForgotForm extends CFormModel
{
    public $email;
    public $userType; // added new member
    private $_identity;

    public function __construct($arg='Front') { // default it is set to Front
        $this->userType = $arg;
    }

	/**
	 * Declares the validation rules.
	 * The rules state that username and password are required,
	 * and password needs to be authenticated.
	 */
	public function rules()
	{
		return array(
                    // username and password are required
                    array('email', 'required'),
            	);
	}
    	
        /**
	 * Logs in the user using the given username and password in the model.
	 * @return boolean whether login is successful
	 */
	public function forgot()
	{
            $user = Users::model()->find('LOWER(email)=?', array(strtolower($this->email)));
            if($user)  return true;
            return false;
	}
  
}
